{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import dautil as dl\n",
    "import seaborn as sns\n",
    "import matplotlib.pyplot as plt\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "from IPython.display import HTML"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "df = dl.data.Weather.load()[['WIND_SPEED', 'WIND_DIR']].dropna()\n",
    "categorized = df.copy()\n",
    "categorized['WIND_DIR'] = dl.data.Weather.categorize_wind_dir(df)\n",
    "categorized['WIND_SPEED'] = dl.data.Weather.beaufort_scale(df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "context = dl.nb.Context('rebinning_data')\n",
    "dl.nb.RcWidget(context)\n",
    "dl.nb.LabelWidget(2, 2, context)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "sp = dl.plotting.Subplotter(2, 2, context)\n",
    "sns.distplot(df['WIND_SPEED'], ax=sp.ax)\n",
    "sp.label(xlabel_params=dl.data.Weather.get_header('WIND_SPEED'))\n",
    "\n",
    "sns.distplot(df['WIND_DIR'], ax=sp.next_ax())\n",
    "sp.label(xlabel_params=dl.data.Weather.get_header('WIND_DIR'))\n",
    "\n",
    "sns.countplot(x='WIND_SPEED', data=categorized, ax=sp.next_ax())\n",
    "sp.label()\n",
    "\n",
    "sns.countplot(x='WIND_DIR', data=categorized, ax=sp.next_ax())\n",
    "sp.label()\n",
    "plt.tight_layout()\n",
    "HTML(dl.report.HTMLBuilder().watermark())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.4.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
